<?php
use yii\helpers\Html;
use \backend\controllers\DtActionFilter;
$project_id = Yii::$app->request->get("project_id");

if (!empty($project_id)){
    $isView = DtActionFilter::checkProject('project_edit',$project_id);
}else{
    $isView=true;
    return '无用户id';
}
?>
<div class="container containerShadow">
        <div class="row ">
            <div class="topimg">
                <div class="left pull-left">
                    <span>基本信息</span>
                </div>
                <div class="pull-right">
                    <a href="javascript:void(0)">
                        <?php
                            if (!empty($isView)){
                                echo Html::img("/image/projectDetails/edit.png",["id"=>"getBase","data-val"=>1]);
                            }
                        ?>
                    </a>
                </div>	
            </div>
            <table class='tableRaius jiBenXinXiList' border="0" cellspacing="0" cellpadding="0" style="border-collapse:separate;border-spacing: 0;">
                <tr>
                    <td>项目名称</td>
                    <td colspan="3">
                    	<pre><?= !empty($Base['title'])?$Base['title']:'' ?></pre>
                    </td>
                    <td>项目编号</td>
                    <td>
                    	<pre><?= !empty($Base['code'])?$Base['code']:'' ?></pre>
                    </td>
                </tr>
                <tr>
                    <td>项目类型</td>
                    <td colspan="3">
                    	<pre><?= !empty($Base['type2'])?Yii::$app->params['projectCategory'][$Base['type2']]['name']:'';?></pre>
                    </td>
                    <td>省份地区</td>
                    <td>
                    	<pre><?= !empty($Base['provinceName'])?$Base['provinceName']:'' ?><?= !empty($Base['cityName'])?$Base['cityName'].'市':'' ?></pre>
                    </td>
                </tr>
                <tr>
                    <td>借款人名称</td>
                    <td colspan="3">
                    	<pre><?=!empty($Base['borrower'])?$Base['borrower']:''?></pre>
                    </td>
                    <td>借款人状况</td>
                    <td>
                    	<pre><?php
                        $borrowerStatesSelected = !empty($Base['management_status']) ? intval($Base['management_status']) :'';
                        $borrowerStates = Yii::$app->params['borrowerStates'];
                        $htmlStr = '';
                        foreach ($borrowerStates as $k => $v){
                            $name = $v['name'];
                            $val  = $v['val'];
                            if ($v['val'] == $borrowerStatesSelected){
                                $htmlStr = $name;
                            }
                        }
                        echo $htmlStr;
                        ?></pre>
                    </td>
                </tr>
                <tr>
                    <td>企业类型</td>
                    <td colspan="3">
                    	<pre><?php
                        $enterpriseVal = !empty($Base['enterprise']) ? array_filter(explode(',',$Base['enterprise'])) :'';
                        $enterprises = Yii::$app->params['enterprises'];
                        $enterpriseStr = '';
                        foreach ($enterprises as $k => $v){
                            $name = $v['name'];
                            $val  = $v['val'];
                            $for  = $v['for'];
                            if (in_array($val,$enterpriseVal)){
                                $enterpriseStr = $name;
                            }
                        }
                        echo $enterpriseStr;
                        ?></pre>
                    </td>
                    <td>所属行业</td>
                    <td>
                    	<pre><?php
                        $industryVal = !empty($Base['industry']) ? array_filter(explode(',',$Base['industry'])) :'';
                        $industrys = Yii::$app->params['industrys'];
                        $industryStr = '';
                        foreach ($industrys as $k => $v){
                            $name = $v['name'];
                            $val  = $v['val'];
                            $for  = $v['for'];
                            if (!empty($industryVal) && in_array($val,$industryVal)){
                                $industryStr = $industryStr.'、'.$name;
                            }
                        }
                        if (!empty($industryStr)){
                            $industryStr = mb_substr($industryStr,1,strlen($industryStr));
                        }
                        echo $industryStr;
                        ?></pre>
                    </td>
                </tr>
                <tr>
                    <td>保证人/抵押人</td>
                    <td colspan="3">
                    	<pre><?= !empty($Base['guarantor'])?$Base['guarantor']:'' ?></pre>
                    </td>
                    <td>保证人/抵押人状况</td>
                    <td>
                    	<pre><?= !empty($Base['guarantor_status'])?$Base['guarantor_status']:'';?></pre>
                    </td>
                </tr>
                <tr class="benJin">
                    <td>本金（元）</td>
                    <td>
                    	<pre><?= !empty($Base['principal'])?\common\helps\formatMoney::format_money($Base['principal'],2):'';?></pre>
                    </td>
                    <td>利息（元）</td>
                    <td>
                    	<pre><?= !empty($Base['interest'])?\common\helps\formatMoney::format_money($Base['interest'],2):'';?></pre>
                    </td>
                    <td>本息合计</td>
                    <td>
                    	<pre><?=\common\helps\formatMoney::format_money($Base['principal']+$Base['interest'],2) ?></pre>
                    </td>
                </tr>
                <tr>
                    <td> 诉讼状态</td>
                    <td colspan="3">
                    	<pre><?= Yii::$app->params['isSuit'][$Base['is_suit']]['name'];?></pre>
                    </td>
                    <td>抵押物类型</td>
                    <td>
                    	<pre><?php
                        $mortgagetypeVal = !empty($Base['mortgage_type']) ? array_filter(explode(',',$Base['mortgage_type'])) :'';
                        $mortgageTypess = Yii::$app->params['mortgageTypes'];
                        $industryStr = '';
                        foreach ($mortgageTypess as $k => $v){
                            $name = $v['name'];
                            $val  = $v['val'];
                            $for  = $v['for'];
                            if (!empty($mortgagetypeVal) && in_array($val,$mortgagetypeVal)){
                                $industryStr = $industryStr.'、'.$name;
                            }
                        }
                        if (!empty($industryStr)){
                            $industryStr = mb_substr($industryStr,1,strlen($industryStr));
                        }
                        echo $industryStr;

//                        foreach ($mortgageTypess as $k => $v){
//                            $name = $v['name'];
//                            $val  = $v['val'];
//                            $for  = $v['for'];
//                            if (!empty($mortgagetypeVal) && in_array($val,$mortgagetypeVal)){
//                                echo $name;
//                            }
//                        }
                        ?></pre>
                    </td>
                </tr>
                <tr>
                    <td>担保方式</td>
                    <td colspan="5">
                        <pre><?= !empty($Base['warranty'])?$Base['warranty']:'';?></pre>
                    </td>
                </tr>
                <tr>
                    <td>项目状态</td>
                    <td colspan="5">
                    	<pre><?php
                               $stateName = '';
                               if (!empty($Base['status'])){
                                   if ($Base['status']==4 ||$Base['status']==5){
                                       $stateName = Yii::$app->params['package_state'][$Base['status']];
                                   }
                               }
                               echo $stateName;
                               ?></pre>
                    </td>
                </tr>
                <tr>
                    <td>亮点说明</td>
                    <td colspan="5">
                    	<pre><?= !empty($Base['highlights'])?$Base['highlights']:'';?></pre>
                    	<!--<textarea name="" rows="" cols="" readonly="readonly" class="list"><?= !empty($Base['highlights'])?$Base['highlights']:'';?></textarea>-->
                    	<!--<input type="text" placeholder="请简要说明财产或亮点明细" value="<?= !empty($Base['highlights'])?$Base['highlights']:'';?>"/>-->
                    </td>
                </tr>
            </table>
        </div>
    </div>
    
    <!-- textarea 高度设置对比div -->
	<div id="textHeight" class="hidden" style="visibility:hidden;min-height: 40px;"></div>
	 

